home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / SPREAD.ZIP / SPRDVIEW.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-16  |  19.1 KB  |  765 lines

  1. // ***********************************************************************
  2. //
  3. //  SPRDVIEW.CPP
  4. //  List Viewer that displays/edits two-dimensional array
  5. //  July 19, 1994
  6. //  Adapted from TListViewer (C.Porter 70262,1047)
  7. //  Curt Thompson  CIS - 70701,2402
  8. // ***********************************************************************
  9.  
  10. #define Uses_TListBox
  11. #define Uses_TEvent
  12. #define Uses_TDialog
  13. #define Uses_TInputLine
  14. #define Uses_TScrollBar
  15. #define Uses_TStaticText
  16. #define Uses_TKeys
  17. #define Uses_TWindow
  18. #define Uses_TView
  19. #define Uses_MsgBox
  20. #include <tv.h>
  21. #include <string.h>
  22. #include <stdlib.h>
  23. #include <stdio.h>
  24. #include <ctype.h>
  25. #include "sprdview.h"
  26.  
  27. const int cmUpdateItemNumber   = 901;
  28.  
  29. #define cpMatrixViewer "\x1A\x1A\x1B\x1C\x1D\x06"
  30.  
  31. const char * const near TMatrixViewer::name = "TMatrixViewer";
  32.  
  33. TMatrixViewer::TMatrixViewer(const TRect& bounds, TScrollBar *aHScrollBar,
  34.   TScrollBar *aVScrollBar, ushort *aColumnWidth) :
  35.   TView(bounds), leftColumn(0), topRow(0), focusedColumn(0), focusedRow(0),
  36.   numColumns(0), numRows(0), headingMode(False)
  37. {
  38.    short arStep, pgStep;
  39.  
  40.    columnWidth = aColumnWidth;
  41.  
  42.    options |= ofFirstClick | ofSelectable;
  43.    eventMask |= evBroadcast;
  44.  
  45.    if (aVScrollBar != 0)
  46.    {
  47.       pgStep = size.y - 1;
  48.       arStep = 1;
  49.       aVScrollBar->setStep(pgStep, arStep);
  50.    }
  51.  
  52.    if (aHScrollBar != 0)
  53.       aHScrollBar->setStep(size.x, 1);
  54.  
  55.    hScrollBar = aHScrollBar;
  56.    vScrollBar = aVScrollBar;
  57.  
  58. }
  59.  
  60.  
  61. void TMatrixViewer::draw()
  62. {
  63.    short i, row, column;
  64.    ushort normalColor, selectedColor, focusedColor, color;
  65.    TDrawBuffer b;
  66.    uchar scOff;
  67.    ushort thisWidth;
  68.  
  69.    focusedColor = getColor(3);
  70.    selectedColor = getColor(4);
  71.    if (headingMode)
  72.       normalColor = getColor(6);
  73.    else if ((state & (sfSelected | sfActive)) == (sfSelected | sfActive))
  74.       normalColor = getColor(1);
  75.    else
  76.       normalColor = getColor(2);
  77.  
  78.    short posColumn = 0;
  79.    for (column = leftColumn; posColumn <= size.x; column++)
  80.    {
  81.       if (column < numColumns)
  82.          thisWidth = *(columnWidth + column);
  83.       else
  84.          thisWidth = size.x - posColumn + 1;
  85.  
  86.       for (i = 0; i < size.y; i++)
  87.       {
  88.          row =  i + topRow;
  89.          if (headingMode)
  90.          {
  91.             color = normalColor;
  92.             scOff = 4;
  93.          }
  94.          else if ((state & (sfSelected | sfActive)) == (sfSelected | sfActive) &&
  95.                 focusedRow == row && focusedColumn == column &&
  96.                 numRows > 0)
  97.          {
  98.             color = focusedColor;
  99.             setCursor(posColumn + 1, i);  // Move the hardware cursor.
  100.             scOff = 0;
  101.          }
  102.          else if (column < numColumns && row < numRows &&
  103.                    isSelected(column, row))
  104.          {
  105.             color = selectedColor;
  106.             scOff = 2;
  107.          }
  108.          else
  109.          {
  110.             color = normalColor;
  111.             scOff = 4;
  112.          }
  113.  
  114.          b.moveChar(0, ' ', color, thisWidth);  // Clear draw buffer.
  115.          if (column < numColumns && row < numRows)
  116.          {
  117.             char text[256];
  118.             getText(text, column, row, thisWidth);
  119.             char buf[256];
  120.             memmove(buf, text, thisWidth);
  121.             buf[thisWidth] = EOS;
  122.             b.moveStr(1, buf, color);
  123.             if (showMarkers)
  124.             {
  125.                b.putChar(0, specialChars[scOff]);
  126.                b.putChar(thisWidth-2, specialChars[scOff+1]);
  127.             }
  128.          }
  129.          else if (i == 0 && column == 0)
  130.          {
  131.             b.moveStr(1, "<empty>", getColor(1));
  132.          }
  133.  
  134.          if (!headingMode && column < (numColumns - 1) && row < numRows)
  135.             b.moveChar(thisWidth-1, (char) 179, getColor(5), 1);
  136.  
  137.          writeLine(posColumn, i, thisWidth, 1, b);
  138.       }
  139.       // Advance to the next column.
  140.       posColumn += thisWidth;
  141.    }
  142.  
  143. }
  144.  
  145.  
  146. void TMatrixViewer::focusItem(short column, short row)
  147. {
  148.  
  149.    focusedColumn = column;
  150.    if (hScrollBar != 0)
  151.         hScrollBar->setValue(column);
  152.    if (column < leftColumn)
  153.    {
  154.       leftColumn = column;
  155.    }
  156.    else
  157.    {
  158.       while (getColumnPosition(column + 1) > size.x)
  159.         leftColumn++;
  160.    }
  161.  
  162.    focusedRow = row;
  163.    if (vScrollBar != 0)
  164.         vScrollBar->setValue(row);
  165.    if (row < topRow)
  166.    {
  167.       topRow = row;
  168.    }
  169.    else
  170.    {
  171.       if (row >= topRow + size.y)
  172.          topRow = row - size.y + 1;
  173.    }
  174.  
  175.    (void) message(owner, evBroadcast, cmUpdateItemNumber, this);
  176.  
  177. }
  178.  
  179.  
  180. void TMatrixViewer::focusItemNum(short column, short row)
  181. {
  182.  
  183.    if (column < 0)
  184.    {
  185.       column = 0;
  186.    }
  187.    else
  188.    {
  189.       if (column >= numColumns)
  190.          column = numColumns - 1;
  191.    }
  192.  
  193.    if (row < 0)
  194.    {
  195.       row = 0;
  196.    }
  197.    else
  198.    {
  199.       if (row >= numRows && numRows > 0)
  200.          row = numRows - 1;
  201.    }
  202.  
  203.    if (numRows !=  0)
  204.       focusItem(column, row);
  205.  
  206. }
  207.  
  208.  
  209. TPalette& TMatrixViewer::getPalette() const
  210. {
  211.     static TPalette palette(cpMatrixViewer, sizeof(cpMatrixViewer)-1);
  212.     return palette;
  213. }
  214.  
  215.  
  216. void TMatrixViewer::getText(char *dest, short, short, short)
  217. {
  218.     *dest = EOS;
  219. }
  220.  
  221.  
  222. Boolean TMatrixViewer::isSelected(short column, short row)
  223. {
  224.     return Boolean((column == focusedColumn) && (row == focusedRow));
  225. }
  226.  
  227.  
  228. void TMatrixViewer::handleEvent(TEvent& event)
  229. {
  230.    TPoint mouse;
  231.    short  oldRow, newRow;
  232.    short  oldColumn, newColumn;
  233.    ushort count;
  234.    int mouseAutosToSkip = 4;
  235.  
  236.    TView::handleEvent(event);
  237.  
  238.    newColumn = oldColumn = focusedColumn;
  239.    newRow = oldRow = focusedRow;
  240.  
  241.    if (event.what == evMouseDown)
  242.    {
  243.       mouse = makeLocal(event.mouse.where);
  244.       for (newColumn = leftColumn;(newColumn < numColumns) &&
  245.          (getColumnPosition(newColumn + 1) <= mouse.x); newColumn++) ;
  246.       newRow = mouse.y + topRow;
  247.       count = 0;
  248.       do  {
  249.          if (newColumn != oldColumn || newRow != oldRow)
  250.             focusItemNum(focusedColumn, newRow);
  251.          oldColumn = newColumn;
  252.          oldRow = newRow;
  253.          mouse = makeLocal(event.mouse.where);
  254.          if (mouseInView(event.mouse.where))
  255.          {
  256.             for (newColumn = leftColumn;(newColumn < numColumns) &&
  257.                (getColumnPosition(newColumn + 1) <= mouse.x); newColumn++) ;
  258.             newRow = mouse.y + topRow;
  259.          }
  260.          else
  261.          {
  262.             if (event.what == evMouseAuto)
  263.                count++;
  264.             if (count == mouseAutosToSkip)
  265.             {
  266.                count = 0;
  267.                if (mouse.x < 0)
  268.                {
  269.                   newColumn = focusedColumn - 1;
  270.                }
  271.                else
  272.                {
  273.                   if (mouse.x >= size.x)
  274.                      newColumn = focusedColumn + 1;
  275.                }
  276.                if (mouse.y < 0)
  277.                {
  278.                   newRow = focusedRow - 1;
  279.                }
  280.                else
  281.                {
  282.                   if (mouse.y >= size.y)
  283.                      newRow = focusedRow + 1;
  284.                }
  285.             }
  286.          }
  287.       } while (mouseEvent(event, evMouseMove | evMouseAuto));
  288.       focusItemNum(newColumn, newRow);
  289.       if (event.mouse.doubleClick && focusedColumn < numColumns &&
  290.            focusedRow < numRows)
  291.       {
  292.          selectItem(focusedColumn, focusedRow);
  293.       }
  294.       clearEvent(event);
  295.    }
  296.    else if (event.what == evKeyDown)
  297.    {
  298.       if (event.keyDown.charScan.charCode ==  ' ' &&
  299.            focusedColumn < numColumns && focusedRow < numRows)
  300.       {
  301.          selectItem(focusedColumn, focusedRow);
  302.       }
  303.       else
  304.       {
  305.          switch (ctrlToArrow(event.keyDown.keyCode))
  306.          {
  307.             case kbUp:
  308.                newRow = oldRow - 1;
  309.                break;
  310.             case kbDown:
  311.                newRow = oldRow + 1;
  312.                break;
  313.             case kbRight:
  314.                newColumn = oldColumn + 1;
  315.                break;
  316.             case kbLeft:
  317.                newColumn = oldColumn - 1;
  318.                break;
  319.             case kbPgDn:
  320.                newRow = oldRow + size.y;
  321.                break;
  322.             case kbPgUp:
  323.                newRow = oldRow - size.y;
  324.                break;
  325.             case kbHome:
  326.                newRow = topRow;
  327.                newColumn = leftColumn;
  328.                break;
  329.             case kbEnd:
  330.                newRow = topRow + size.y - 1;
  331.                for (newColumn = leftColumn; (newColumn < numColumns) &&
  332.                   (getColumnPosition(newColumn + 1) <= size.x); newColumn++) ;
  333.                break;
  334.             case kbCtrlPgDn:
  335.                newRow = numRows - 1;
  336.                break;
  337.             case kbCtrlPgUp:
  338.                newRow = 0;
  339.                break;
  340.             case kbTab:
  341.                newColumn = oldColumn + 1;
  342.                if (newColumn >= numColumns)
  343.                {
  344.                  newRow = oldRow + 1;
  345.                  if (newRow >= numRows)
  346.                    newRow = 0;
  347.                  newColumn = 0;
  348.                }
  349.                break;
  350.             case kbShiftTab:
  351.                if (oldColumn == 0)
  352.                {
  353.                  if (oldRow == 0)
  354.                    oldRow = numRows;
  355.                  newRow = oldRow - 1;
  356.                  oldColumn = numColumns;
  357.                }
  358.                newColumn = oldColumn - 1;
  359.                break;
  360.             default:
  361.                return;
  362.          }
  363.       }
  364.       focusItemNum(newColumn, newRow);
  365.       clearEvent(event);
  366.    }
  367.    else if (event.what == evBroadcast)
  368.    {
  369.       if ((options & ofSelectable) != 0)
  370.       {
  371.          if (event.message.command == cmScrollBarClicked &&
  372.                   (event.message.infoPtr == hScrollBar ||
  373.                     event.message.infoPtr == vScrollBar))
  374.          {
  375.             select();
  376.          }
  377.          else if (event.message.command == cmScrollBarChanged)
  378.          {
  379.             if (vScrollBar == event.message.infoPtr)
  380.             {
  381.                focusItemNum(hScrollBar->value, vScrollBar->value);
  382.                drawView();
  383.             }
  384.             else if (hScrollBar == event.message.infoPtr)
  385.             {
  386.                focusItemNum(hScrollBar->value, vScrollBar->value);
  387.                drawView();
  388.             }
  389.          }
  390.       }
  391.    }
  392.  
  393. }
  394.  
  395.  
  396. void TMatrixViewer::selectItem(short, short)
  397. {
  398.    (void) message(owner, evBroadcast, cmListItemSelected, this);
  399. }
  400.  
  401.  
  402. void TMatrixViewer::setRange(short aColumns, short aRows)
  403. {
  404.  
  405.    numColumns = aColumns;
  406.    if (hScrollBar != 0)
  407.    {
  408.       if (focusedColumn > aColumns)
  409.          focusedColumn = 0;
  410.       hScrollBar->setParams(focusedColumn, 0, aColumns - 1, hScrollBar->pgStep,
  411.          hScrollBar->arStep);
  412.    }
  413.  
  414.    numRows = aRows;
  415.    if (vScrollBar != 0)
  416.    {
  417.       if (focusedRow > aRows)
  418.          focusedRow = 0;
  419.       vScrollBar->setParams(focusedRow, 0, aRows - 1, vScrollBar->pgStep,
  420.          vScrollBar->arStep);
  421.    }
  422.  
  423. }
  424.  
  425.  
  426. void TMatrixViewer::setState(ushort aState, Boolean enable)
  427. {
  428.  
  429.    TView::setState(aState, enable);
  430.    if ((aState & (sfSelected | sfActive)) != 0)
  431.    {
  432.       if (hScrollBar != 0)
  433.       {
  434.          if (getState(sfActive))
  435.             hScrollBar->show();
  436.          else
  437.             hScrollBar->hide();
  438.       }
  439.       if (vScrollBar != 0)
  440.       {
  441.          if (getState(sfActive))
  442.             vScrollBar->show();
  443.          else
  444.             vScrollBar->hide();
  445.       }
  446.       drawView();
  447.    }
  448.  
  449. }
  450.  
  451.  
  452. short TMatrixViewer::getColumnPosition(short column)
  453. {
  454.  
  455.    short position = 0;
  456.    for (int i = leftColumn; i < numColumns; i++)
  457.    {
  458.       if (i == column)
  459.          break;
  460.       position += *(columnWidth + i);
  461.    }
  462.    return (position);
  463.  
  464. }
  465.  
  466.  
  467. void TMatrixViewer::shutDown()
  468. {
  469.  
  470.    hScrollBar = 0;
  471.    vScrollBar = 0;
  472.    TView::shutDown();
  473.  
  474. }
  475.  
  476.  
  477. void TMatrixViewer::write(opstream& os)
  478. {
  479.  
  480.    TView::write(os);
  481.    os << hScrollBar << vScrollBar << topRow << focusedRow << numRows;
  482.  
  483. }
  484.  
  485.  
  486. void *TMatrixViewer::read(ipstream& is)
  487. {
  488.  
  489.    (void) TView::read(is);
  490.    is >> hScrollBar >> vScrollBar >> topRow >> focusedRow >> numRows;
  491.    return this;
  492.  
  493. }
  494.  
  495.  
  496. TStreamable *TMatrixViewer::build()
  497. {
  498.  
  499.    return new TMatrixViewer(streamableInit);
  500.  
  501. }
  502.  
  503.  
  504. TMatrixViewer::TMatrixViewer(StreamableInit) : TView(streamableInit)
  505. {
  506. }
  507.  
  508.  
  509.  
  510. const int cmListKeyEnter           = 59;
  511.  
  512.  
  513. THeadingViewBox::THeadingViewBox(const TRect& bounds, TScrollBar *aHScroller,
  514.    TScrollBar *aVScroller, char **aListText, short aColumns, short aRows,
  515.    ushort *aColumnWidth) :
  516.    TMatrixViewer(bounds, aHScroller, aVScroller, aColumnWidth)
  517. {
  518.  
  519.    ListText = aListText;
  520.    setRange(aColumns, aRows);
  521.    if (aHScroller != 0)
  522.      aHScroller->maxVal = aColumns-1;
  523.    if (aVScroller != 0)
  524.      aVScroller->maxVal = aRows-1;
  525.    headingMode = True;
  526.  
  527. }
  528.  
  529.  
  530. void THeadingViewBox::getText(char *dest, short column, short row, short maxLen)
  531. {
  532.  
  533.    sprintf(dest, "%*s", maxLen - 2, *(ListText + column + row * numColumns));
  534.  
  535. }
  536.  
  537.  
  538.  
  539.  
  540. TListViewBox::TListViewBox(const TRect& bounds, TScrollBar *aHScroller,
  541.    TScrollBar *aVScroller, ListRec *aListData, short aColumns,
  542.    short aRows, ushort *aColumnWidth, ushort *aDecimalPoint) :
  543.    TMatrixViewer(bounds, aHScroller, aVScroller, aColumnWidth)
  544. {
  545.  
  546.    ListData = aListData;
  547.    columnWidth = aColumnWidth;
  548.    decimalPoint = aDecimalPoint;
  549.    setRange(aColumns, aRows);
  550.    if (aHScroller != 0)
  551.       aHScroller->maxVal = aColumns-1;
  552.    if (aVScroller != 0)
  553.       aVScroller->maxVal = aRows-1;
  554.  
  555. }
  556.  
  557.  
  558. TListViewBox::~TListViewBox()
  559. { }
  560.  
  561.  
  562. void TListViewBox::getText(char *dest, short column, short row, short maxLen)
  563. {
  564.    ListRec *ptr;
  565.  
  566.    ptr = (ListData + column + row * numColumns);
  567.    if (ptr->show)
  568.       sprintf(dest, "%*.*lf", maxLen-2, *(decimalPoint + column), ptr->val);
  569.    else
  570.       *dest = EOS;
  571.  
  572. }
  573.  
  574.  
  575. void TListViewBox::handleEvent(TEvent& event)
  576. {
  577.  
  578.    if ((event.what == evMouseDown) && (event.mouse.doubleClick))
  579.    {
  580.       (void) message(owner, evBroadcast, cmListItemSelected, this);
  581.       clearEvent(event);
  582.    }
  583.    if ((event.what == evKeyDown) && (event.keyDown.keyCode == kbEnter))
  584.    {
  585.       (void) message(owner, evBroadcast, cmListKeyEnter, this);
  586.       clearEvent(event);
  587.    }
  588.  
  589.   TMatrixViewer::handleEvent(event);
  590.  
  591. }
  592.  
  593.  
  594. void TListViewBox::putData(void *rec)
  595. {
  596.    ListRec *ptr;
  597.    char *txt;
  598.  
  599.    txt = (char *)rec;
  600.    ptr = (ListData + focusedColumn + focusedRow * numColumns);
  601.    while (isspace(*txt))
  602.      strcpy(txt, txt + 1);
  603.    if (*txt == EOS)
  604.    {
  605.       ptr->val = 0.0;
  606.       ptr->show = False;
  607.    }
  608.    else
  609.    {
  610.       ptr->val = atof((char *)rec);
  611.       ptr->show = True;
  612.    }
  613.    draw();
  614.  
  615. }
  616.  
  617.  
  618.  
  619.  
  620.  
  621. TListViewDialog::TListViewDialog(TRect &trect, char *aTitle, char **aHeading,
  622.    short aHeadRows, ListRec *aListData, short aColumns, short aRows,
  623.    ushort *aColumnWidth, ushort *aDecimalPoint) :
  624.    TDialog(trect, aTitle),
  625.    TWindowInit(TDialog::initFrame)
  626. {
  627.  
  628.    options |= ofCentered;
  629.  
  630.    // Calculate the list box width and height.
  631.    const int maxStr = 30;
  632.  
  633.    // Create a rectangle for scroll box. */
  634.    TRect r = TRect(1, 3, size.x - 2,
  635.       size.y - 3);
  636.  
  637.    // Create a horizontal scroll bar for the list box.
  638.    horzScroller = new TScrollBar(TRect(r.a.x, r.b.y,
  639.       r.b.x, r.b.y + 1));
  640.  
  641.    // Create a vertical scroll bar for the list box.
  642.    vertScroller = new TScrollBar(TRect(r.b.x, r.a.y,
  643.       r.b.x + 1, r.b.y));
  644.  
  645.    // Create a scrolling heading box. */
  646.    headingBox = new THeadingViewBox(TRect(r.a.x, r.a.y - aHeadRows,
  647.       r.b.x, r.a.y), horzScroller, 0, aHeading, aColumns, aHeadRows,
  648.       aColumnWidth);
  649.    headingBox->growMode = gfGrowHiX;
  650.  
  651.    // Create a scroll box. */
  652.    listBox = new TListViewBox(r, horzScroller, vertScroller, aListData,
  653.       aColumns, aRows, aColumnWidth, aDecimalPoint);
  654.    listBox->growMode = gfGrowHiX | gfGrowHiY;
  655.  
  656.    // Create the input line..
  657.    inputLine = new TInputLine(TRect(r.a.x, r.a.y, r.a.x + *aColumnWidth - 1,
  658.       r.a.y + 1), maxStr);
  659.    inputLine->hide(); //hide input line
  660.  
  661.    // Create an (unselectable) box to hold the line number.
  662.    itemNumber = new TInputLine(TRect(r.b.x - 7, r.b.y + 1,
  663.       r.b.x - 1, r.b.y + 2), 5);
  664.    itemNumber->options &= ~ofSelectable;
  665.    itemNumber->growMode |= gfGrowAll;
  666.    (void) itoa(listBox->focusedRow, itemNumber->data, 10);
  667.  
  668.    insert(horzScroller);
  669.    insert(vertScroller);
  670.    insert(headingBox);
  671.    insert(listBox);
  672.    insert(inputLine);
  673.    insert(itemNumber);
  674.  
  675. }
  676.  
  677.  
  678. void TListViewDialog::handleEvent(TEvent &event)
  679. {
  680.  
  681.    switch(event.what)
  682.    {
  683.       case evMouseDown:  // clears input line
  684.      if (inputLine->state&sfSelected)
  685.          {
  686.         inputLine->hide();
  687.      }
  688.      break;
  689.       case evKeyDown:
  690.      switch(event.keyDown.keyCode)
  691.      {
  692.         case kbEsc:  // clears input line
  693.            if (inputLine->state & sfSelected)
  694.                {
  695.           inputLine->hide();
  696.           clearEvent(event);
  697.            }
  698.            break;
  699.         case kbEnter: // saves input line to list box using listBoxPtr
  700.            if (inputLine->state & sfSelected)
  701.                {
  702.                   char work[256];
  703.                   inputLine->getData(work);
  704.                   listBoxPtr->putData(work);
  705.           inputLine->hide();
  706.           clearEvent(event);
  707.            }
  708.            break;
  709.             default:
  710.                break;
  711.      }
  712.          break;
  713.       case evBroadcast: // from List Boxes, infoPtr points to orginator
  714.      switch (event.message.command)
  715.      {
  716.         case cmListItemSelected: // if input line is already showing, hide it
  717.            if (inputLine->state & sfSelected)
  718.                {
  719.           inputLine->hide();
  720.           clearEvent(event);
  721.            }
  722.            else   // show empty input line
  723.                {
  724.           int mouseLocY =((TListViewBox *)event.message.infoPtr)->cursor.y;
  725.                   int mouseLocX =((TListViewBox *)event.message.infoPtr)->cursor.x;
  726.           listBoxPtr =(TListViewBox *)event.message.infoPtr;
  727.                   inputLine->growTo(*(listBoxPtr->columnWidth +
  728.                      listBoxPtr->focusedColumn) - 1, 1);
  729.           inputLine->moveTo(mouseLocX, mouseLocY + 3);
  730.           strcpy(inputLine->data,"");
  731.           inputLine->show();
  732.           clearEvent(event);
  733.            }
  734.            break;
  735.         case cmListKeyEnter: // enter key pressed in list box, copy data to inputline
  736.            int mouseLocY =((TListViewBox *)event.message.infoPtr)->cursor.y;
  737.            int mouseLocX =((TListViewBox *)event.message.infoPtr)->cursor.x;
  738.            listBoxPtr =(TListViewBox *)event.message.infoPtr;
  739.            inputLine->growTo(*(listBoxPtr->columnWidth +
  740.                   listBoxPtr->focusedColumn) - 1, 1);
  741.            inputLine->moveTo(mouseLocX, mouseLocY + 3);
  742.            listBoxPtr->getText(inputLine->data,
  743.                   listBoxPtr->focusedColumn, listBoxPtr->focusedRow,
  744.                   inputLine->maxLen);
  745.            inputLine->show();
  746.            clearEvent(event);
  747.            break;
  748.         case cmUpdateItemNumber:
  749.                (void) itoa(listBox->focusedRow, itemNumber->data, 10);
  750.                itemNumber->draw();
  751.            clearEvent(event);
  752.            break;
  753.             default:
  754.                break;
  755.      }
  756.          break;
  757.       default:
  758.          break;
  759.    }
  760.    // Let TDialog handler do it's thing with any remaining events.
  761.    TDialog::handleEvent(event);
  762.  
  763. }
  764.  
  765.